# encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models

class Migration(SchemaMigration):

    def forwards(self, orm):
        
        # Adding model 'Service'
        db.create_table('sto_service', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('name', self.gf('django.db.models.fields.CharField')(max_length=250)),
            ('description', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal('sto', ['Service'])

        # Adding model 'STOJournal'
        db.create_table('sto_stojournal', (
            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('datetime', self.gf('django.db.models.fields.DateTimeField')(auto_now=True, auto_now_add=True, blank=True)),
            ('client', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['washing.Client'], null=True, blank=True)),
            ('sum', self.gf('django.db.models.fields.FloatField')()),
        ))
        db.send_create_signal('sto', ['STOJournal'])

        # Adding M2M table for field service on 'STOJournal'
        db.create_table('sto_stojournal_service', (
            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
            ('stojournal', models.ForeignKey(orm['sto.stojournal'], null=False)),
            ('service', models.ForeignKey(orm['sto.service'], null=False))
        ))
        db.create_unique('sto_stojournal_service', ['stojournal_id', 'service_id'])


    def backwards(self, orm):
        
        # Deleting model 'Service'
        db.delete_table('sto_service')

        # Deleting model 'STOJournal'
        db.delete_table('sto_stojournal')

        # Removing M2M table for field service on 'STOJournal'
        db.delete_table('sto_stojournal_service')


    models = {
        'sto.service': {
            'Meta': {'object_name': 'Service'},
            'description': ('django.db.models.fields.TextField', [], {}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'name': ('django.db.models.fields.CharField', [], {'max_length': '250'})
        },
        'sto.stojournal': {
            'Meta': {'object_name': 'STOJournal'},
            'client': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['washing.Client']", 'null': 'True', 'blank': 'True'}),
            'datetime': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'auto_now_add': 'True', 'blank': 'True'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'service': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['sto.Service']", 'symmetrical': 'False'}),
            'sum': ('django.db.models.fields.FloatField', [], {})
        },
        'washing.client': {
            'Meta': {'object_name': 'Client'},
            'auto_number': ('django.db.models.fields.CharField', [], {'max_length': '6'}),
            'auto_region': ('django.db.models.fields.IntegerField', [], {}),
            'discount': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
            'fio': ('django.db.models.fields.CharField', [], {'max_length': '250'}),
            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'phone': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'}),
            'phone1': ('django.db.models.fields.CharField', [], {'max_length': '25', 'null': 'True', 'blank': 'True'})
        }
    }

    complete_apps = ['sto']
